﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using StevensReceipts.Domain;
using StevensReceipts.Repository;

namespace StevensReceipts.Web.Controllers
{
    public class ReceiptController : Controller
    {
        private readonly IReceiptsDataSource _ds;
        //
        // GET: /Receipt/

        public ReceiptController(IReceiptsDataSource ds)
        {
            _ds = ds;
        }

        //load all receipts for current calendar year
        public ActionResult Index()
        {
            var receipts = _ds.Receipts.Get(r => r.TransactionDate < DateTime.Now && r.TransactionDate > DateTime.Now.AddDays(-30));

            return View(receipts);
        }

    }
}
